home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 1.9 KB | 77 lines |
- package symantec.itools.awt.shape;
-
-
- import java.awt.Graphics;
- import java.awt.Color;
-
-
- /**
- * This class forms the Ellipse shape component.
- * @see symantec.itools.awt.shape.Circle
- * @version 1.0, Nov 26, 1996
- * @author Symantec
- */
-
- public class Ellipse
- extends Shape
- {
- /**
- * Constructs a default Ellipse.
- */
- public Ellipse()
- {
- }
-
- /**
- * Paints the ellipse using the given graphics context.
- * This is a standard Java AWT method which typically gets called
- * by the AWT to handle painting this component. It paints this component
- * using the given graphics context. The graphics context clipping region
- * is set to the bounding rectangle of this component and its <0,0>
- * coordinate is this component's top-left corner.
- *
- * @param g the graphics context used for painting
- * @see java.awt.Component#repaint
- * @see java.awt.Component#update
- */
- public void paint(Graphics g)
- {
- g.clipRect(0, 0, width, height);
-
- int w = width - 1, h = height - 1;
-
- if (fill)
- {
- g.setColor(fillColor);
- g.fillOval(0, 0, w, h);
- }
- else
- {
- switch (style) {
-
- case BEVEL_LINE :
- default :
- g.drawOval(0, 0, w, h);
- break;
-
- case BEVEL_LOWERED :
- g.setColor(Color.gray);
- g.drawArc(0, 0, w, h, 45, 180);
-
- g.setColor(Color.white);
- g.drawArc(0, 0, w, h, 225, 180);
- break;
-
- case BEVEL_RAISED :
- g.setColor(Color.white);
- g.drawArc(0, 0, w, h, 45, 180);
-
- g.setColor(Color.gray);
- g.drawArc(0, 0, w, h, 225, 180);
- break;
- }
- }
- }
- }
-
-